#ifndef _ThreadPool_HPP_
#define _ThreadPool_Hpp_

#include "Thread.hpp"
#include "TaskQueue.hpp"

#include <memory>
#include <vector>
using std::vector;
using std::unique_ptr;

namespace tp{

class ThreadPool{
friend class myThread;
public:
    ThreadPool(int,int );
    ~ThreadPool();
    void start();
    void stop();
    void addTask(ElemType);
private:
    void doTask(); //作为线程run函数的具体执行内容

private:
    vector<unique_ptr<tp::Thread>> _threads;
    int _thread_num;
    int _que_size;
    TaskQueue _taskque;
    bool _isExit;
};

}

#endif

